package com.qingcloud.adminbackend.controller;

import com.qingcloud.adminbackend.base.AjaxResult;
import com.qingcloud.adminbackend.constant.WamingConstant;
import com.qingcloud.adminbackend.entity.equipment.ProductionStateDTO;
import com.qingcloud.adminbackend.entity.equipment.ProductionStateVO;
import com.qingcloud.adminbackend.service.IProductionStateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * 生产状态管理
 *
 * @author liuziyong
 */
@RestController
@RequestMapping("/production/state")
@Api(value = "生产状态管理API接口", description = "生产状态管理API接口")
public class ProductionStateController {

    @Resource
    private IProductionStateService productionStateService;

    @ApiOperation(value = "设备生产状态分页查询", notes = "设备生产状态分页查询", response = ProductionStateVO.class)
    @PostMapping("/findPage")
    public AjaxResult products(@RequestBody ProductionStateDTO dto) {
        return new AjaxResult(WamingConstant.SUCCESS, null,
                productionStateService.findProductionStatePage(dto));
    }

    @ApiOperation(value = "生产测试完成文件导入", notes = "生产测试完成文件导入")
    @PostMapping("/importFile")
    public AjaxResult importFile(@RequestParam("excelFile") MultipartFile excelFile) throws Exception {
        return productionStateService.importFile(excelFile);
    }
}
